<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      var num = 1;
      switch (num + 1) {
        case 1:
          console.log('结果为1');
          break;
        case 2:
          console.log('结果为2');
          break;
        default:
          console.log('结果未知');
      }
    </script>
  </body>
</html>